﻿Namespace Forms.Edit

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class frmStudentLessonExceptionDetails
    Inherits org.codegen.win.controls.frmBaseEdit

#Region "Designer"
    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    Friend WithEvents UcStudentLessonException As UcStudentLessonExceptionDetails

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
            Me.components = New System.ComponentModel.Container()
            Me.UcStudentLessonException = New IIC.ucStudentLessonExceptionDetails()
            Me.SuspendLayout()
            '
            'UcEditToolar
            '
            Me.UcEditToolar.ShowAdd = True
            Me.UcEditToolar.ShowDelete = True
            Me.UcEditToolar.ShowNavigationButtons = True
            Me.UcEditToolar.Size = New System.Drawing.Size(773, 30)
            '
            'UcStudentLessonException
            '
            Me.UcStudentLessonException.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange
            Me.UcStudentLessonException.Dock = System.Windows.Forms.DockStyle.Fill
            Me.UcStudentLessonException.isInitialized = False
            Me.UcStudentLessonException.Location = New System.Drawing.Point(0, 30)
            Me.UcStudentLessonException.ModelObject = Nothing
            Me.UcStudentLessonException.Name = "UcStudentLessonException"
            Me.UcStudentLessonException.Size = New System.Drawing.Size(773, 247)
            Me.UcStudentLessonException.TabIndex = 0
            '
            'frmStudentLessonExceptionDetails
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(773, 299)
            Me.Controls.Add(Me.UcStudentLessonException)
            Me.Name = "frmStudentLessonExceptionDetails"
            Me.ShowAdd = True
            Me.ShowDelete = True
            Me.ShowNavigationButtons = True
            Me.Text = "Student Lesson Exception"
            Me.Controls.SetChildIndex(Me.UcEditToolar, 0)
            Me.Controls.SetChildIndex(Me.UcStudentLessonException, 0)
            Me.ResumeLayout(False)
            Me.PerformLayout()

        End Sub

#End Region

#Region "Standard Code"
	
	Public Overrides Sub DeleteData()

            Dim mapper As StudentLessonCreditDBMapper = New StudentLessonCreditDBMapper()
            mapper.deleteByKey(Me.IdValue)

            'after delete, close the form
            'Note: do not set the dialog result here.  It is handled by the frmBaseEdit, ie do not call Me.DialogResult = Windows.Forms.DialogResult.None

        End Sub

        Public Overrides Sub LoadData()

            Me.UcStudentLessonException.ModelObject = New StudentLessonCreditDBMapper().findByKey(Me.IdValue)
            Me.UcStudentLessonException.loadData()
            Me.setRecordLoadedStatus(Me.IdValue)

        End Sub


        Public Overrides Function SaveData() As enumSaveDataResult

            If Me.ValidateChildren() Then
                Me.UcStudentLessonException.loadToObject()
                Dim db As New StudentLessonCreditDBMapper()
                db.save(Me.UcStudentLessonException.ModelObject)
                Return enumSaveDataResult.SAVE_SUCESS_AND_CLOSE
            Else
                Return enumSaveDataResult.SAVE_FAIL
            End If

        End Function
	
	Public Overrides Function dataChanged() As Boolean

		Return Me.UcStudentLessonException.hasChanges

    End Function


        ''' <summary>
        ''' On the load, we need to call "resetLastLoadedValues"
        ''' at the **end** of the method.  This call keeps track of the 
        ''' loaded data on the page, for the 'datachanged' functionality
        ''' </summary>
        Private Sub frm_Load(ByVal sender As Object, _
                                    ByVal e As System.EventArgs) Handles Me.Load

            '**** any code should go before "resetLastLoadedValues"


            '***** IMPORTANT: keep this call at the end of the procedure
            Call Me.UcStudentLessonException.resetLastLoadedValues()

        End Sub
#End Region

        Private _DefaultStudentId As Integer
        Private _DefaultLessonId As Integer

        Public Property DefaultLessonId() As Integer
            Get
                Return _DefaultLessonId
            End Get
            Set(ByVal value As Integer)
                _DefaultLessonId = value
                If _DefaultLessonId > 0 Then
                    Me.UcStudentLessonException.LessonId.Value = Me._DefaultLessonId
                    Me.UcStudentLessonException.LessonId.ReadOnly = True
                End If

            End Set
        End Property
        Public Property DefaultStudentId() As Integer
            Get
                Return _DefaultStudentId
            End Get
            Set(ByVal value As Integer)
                _DefaultStudentId = value
                If (Me._DefaultStudentId > 0) Then
                    Me.UcStudentLessonException.StudentId.Value = Me._DefaultStudentId
                    Me.UcStudentLessonException.StudentId.ReadOnly = True
                End If

            End Set
        End Property


End Class

End Namespace

